package com.example.environment.tools.common;

import lombok.Data;

@Data
public class ResultMsg<T> {

    private Integer code;
    private String msg;
    private T sendResult;

    public ResultMsg(){

    }

    public ResultMsg(Integer code,String msg){
        this.code=code;
        this.msg=msg;
    }
    public ResultMsg(Integer code,String msg,T result){
        this.code=code;
        this.msg=msg;
        this.sendResult=result;
    }

    public static<T>  ResultMsg<T>  successOp(T result){
        return new ResultMsg<>(ResultCode.SUCCESS.getCode(), ResultCode.SUCCESS.getMsg(),result);
    }

    public static<T>  ResultMsg<T>  failOp(T result){
        return new ResultMsg<>(ResultCode.FAILED.getCode(), ResultCode.FAILED.getMsg(),result);
    }

    public static<T>  ResultMsg<T>  ExistPhone(){
        return new ResultMsg<>(ResultCode.ExistPhone.getCode(), ResultCode.ExistPhone.getMsg());
    }

}
